﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.Data.SqlClient;

namespace QL_NOI_TRU
{
    public partial class frmChiDinhXuatVien : DevExpress.XtraEditors.XtraForm
    {
        public frmChiDinhXuatVien()
        {
            InitializeComponent();
        }

        private void frmChiDinhXuatVien_Load(object sender, EventArgs e)
        {
            // đổ dữ liệu vào cbbMaBenhAn
            var maBA = "select MABENHAN from BENH_AN";
            SqlConnection conn = new SqlConnection(frmDangnhap.stringConn);
            SqlCommand cm = conn.CreateCommand();
            cm.CommandText = maBA;
            conn.Open();
            SqlDataReader dr = cm.ExecuteReader();
            while (dr.Read())
            {
                var newVariable = cbbMaBenhAn.Properties.Items.Add(String.Format("{0}", dr["MABENHAN"]));
            }
            dr.Close();
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Xác nhận thành công");
        }

        private void cbbMaBenhAn_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
                txtVaoVienNgay.Focus();
        }

        private void txtVaoVienNgay_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
                txtPhong.Focus();
        }

        private void txtPhong_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
                txtKhoa.Focus();
        }

        private void txtKhoa_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
                txtGiuong.Focus();
        }

        private void txtGiuong_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
                cbbNgayXN.Focus();
        }

        private void cbbNgayXN_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
                txtLyDo.Focus();
        }

        private void txtLyDo_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
                btInPhieu.Focus();
        }



    }
}